package com.common.exception;


import com.common.enums.ResultEnum;
import lombok.Data;

import java.util.Map;

/**
 * @类名 CommonException
 * @描述
 * @版本 1.0
 * @创建人 lying
 * @创建时间 2020/1/8 14:25
 * @修改人 lying
 * @修改时间 2020/1/8 14:25
 **/
@Data
public class BusinessException extends  RuntimeException {
   private ResultEnum resultEnum;
   private Object requestParam;
   private Map<String,Object> data;

   public BusinessException(ResultEnum resultEnum) {
      super(resultEnum.getI18nKey());
      this.resultEnum = resultEnum;
   }

   public BusinessException(String message, ResultEnum resultEnum) {
      super(message);
      this.resultEnum = resultEnum;
   }

   public BusinessException(String message, ResultEnum resultEnum, Map<String,Object> data) {
      super(message);
      this.resultEnum = resultEnum;
      this.data = data;
   }

   public BusinessException(String message){
     super(message);
     this.resultEnum =null;
   }

   public BusinessException(String message, Object requestParam){
     super(message);
     this.requestParam =requestParam;
   }
}
